package com.hex.ds.hdtp.core.app.script.transfer.converter;

import com.hex.ds.hdtp.core.app.script.transfer.dto.request.ScriptVerifyLogRequestDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptConvertTargetListResponseDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptVerifyLogResponseDto;
import com.hex.ds.hdtp.core.inf.script.transfer.po.ScriptVerifyLogPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface IScriptVerifyLogConverter {

    ScriptVerifyLogPo toScriptTestLogPo(ScriptVerifyLogRequestDto scriptVerifyLogRequestDto);

    ScriptVerifyLogResponseDto toScriptTestLogResponseDto(ScriptVerifyLogPo scriptVerifyLogPo);

    List<ScriptVerifyLogResponseDto> toScriptTestLogResponseDtoList(List<ScriptVerifyLogPo> scriptList);

    @Mapping(target = "pkId", ignore = true)
    @Mapping(target = "scriptConvertListId", source = "scriptConvertTargetList.pkId")
    @Mapping(target = "fileName", source = "scriptConvertTargetList.convertFileName")
    @Mapping(target = "status", source = "scriptConvertTargetList.emptyTestStatus")
    @Mapping(target = "testStartTs", source = "scriptConvertTargetList.startTime")
    @Mapping(target = "testEndTs", source = "scriptConvertTargetList.endTime")
    @Mapping(target = "testLog", source = "scriptConvertTargetList.errorMessage")
    ScriptVerifyLogRequestDto toScriptEmptyTestLogRequestDto(ScriptConvertTargetListResponseDto scriptConvertTargetList);
}
